#ifndef NIXONBOT_CORE_BNCS_PROTOCOL_UNKNOWN_H_
#define NIXONBOT_CORE_BNCS_PROTOCOL_UNKNOWN_H_

#include <nixonbot/core/bncs/protocol/Message.h>

namespace nixonbot {
namespace core {
namespace bncs {
namespace protocol {

struct UnknownData : public QSharedData
{
	QVector<quint8> data;
};

class Unknown : public Message
{
/* This message has indeterminate ID, so it does not get registered 
 * with the factory. */
	
private:
	int id;
	int size;
	
public:
	QSharedDataPointer<UnknownData> d;

public:
	Unknown(int id, int size)
	{
		this->id = id;
		this->size = size;
		
		this->d = new UnknownData();
		this->d->data.reserve(size);
	}
	
	virtual Unknown* create()
	{
		return new Unknown(id, size);
	}
	
	virtual int id()
	{
		return id;
	}
	
	virtual int size()
	{
		return size;
	}
	
protected:
	virtual void readFrom(QDataStream& ds)
	{
		ds.readRawData(d->data.data(), size);
	}
	
	virtual void writeTo(QDataStream& ds)
	{
		ds.writeRawData(d->data.constData(), size);
	}
};

}
}
}
}

#endif /*NIXONBOT_CORE_BNCS_PROTOCOL_UNKNOWN_H_*/
